package Day08.Demo02;

/**
 * @author HYHwtx
 * @version 1.0
 * @date 2022/2/13 19:33
 */
public class Demo04StringConvert {
    public static void main(String[] args) {
        //转换为字符数组
        char[] chars = "Hello".toCharArray();
        System.out.println(chars[0]);
        System.out.println(chars.length);
        System.out.println("==================");
        //转换为字节数组
        byte[] bytes = "abc".getBytes();
        for (int i = 0; i < bytes.length; i++) {
            System.out.println(bytes[i]);
        }
        System.out.println("====================");

        //字符串的内容替换
        String str1 = "How do you do";
        String str2 = str1.replace("o", "*");
        System.out.println(str2);
        System.out.println("=====================");

        String lang1 ="会不会玩呀！，你大爷的!你大爷的!你大爷的!你大爷的!";
        String lang2 = lang1.replace("你大爷的", "****");
        System.out.println(lang2);
    }
}
